<?php

if(empty($cat)) $cat = 'view user subtitles';
if(empty($right_side)) {$right_side = '';}
if(empty($left_side)) {$left_side = '';}
if(empty($content)) {$content = '';}


$right_side = $right_side . quick_info('Quick Summary','
users count: '.get_users_count().'
<br>subtitles count: '.get_subtitles_count().'
<br>videos count: '.get_videos_count().'
');

$right_side = $right_side . "<br>" . quick_links('Quick Links','
<a href="http://sourceforge.net/projects/onlinesubtitles/forums/forum/1758498" target="_blank">Open Discussion</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><a href="http://sourceforge.net/tracker/?group_id=534975&atid=2172715" target="_blank">Bugs</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><a href="http://sourceforge.net/projects/onlinesubtitles/forums/forum/1758499" target="_blank">Help Forum</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><a href="http://sourceforge.net/tracker/?group_id=534975&atid=2172718" target="_blank">Feature Requests</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><a href="http://sourceforge.net/projects/onlinesubtitles/forums/forum/1761558" target="_blank">Security Forum</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><a href="http://sourceforge.net/tracker/?group_id=534975&atid=2172716" target="_blank">Support Requests</a>
');

$home_list[0][0] = 'view user subtitles';
$home_list[0][1] = 'index.php?page=subtitles&cat=view user subtitles';
$left_side = $left_side . left_list('subtitle options',$home_list);


//echo $themes_list;

$content = $content . content_tabs($cat, "
                <div class='table'>
				<form method='post' action='index.php'>
                    <table class='listing form' cellpadding='0' cellspacing='0'>
                        <tr>
                            <th class='full' colspan='2'>Find User Subtitles</th>
                        </tr>
                        <tr>
                            <td><strong>user name</strong></td>
                            <td><input type='text' name='subtitle_user_name' /></td>
                        </tr>
                    </table>
					<input type='hidden' name='page' value='subtitles' />
					<input type='hidden' name='cat' value='view user subtitles' />
					<input type='hidden' name='find_user_subtitles' value='yes' />
					<input type='submit' value='search' />
					</form>
                </div>
				
");

if(!empty($delete_user_subtitle) and $delete_user_subtitle=="yes")
{
delete_subtitle($subtitle_id);
}

if(!empty($find_user_subtitles) and $find_user_subtitles=="yes")
{
$user_information = get_user_info_by_username($subtitle_user_name);
//view_array($user_information);
$all_user_subtitles = get_user_subtitles($user_information['id']);
//view_array($all_user_subtitles);

$content = $content . "
                <div>
                    <table class='listing form' cellpadding='0' cellspacing='0'>
                        <tr>
                            <th class='full' colspan='2'>User Subtitles</th>
                        </tr>";

for ($i = 0; $i <= count($all_user_subtitles)-1; $i++) {
 $content = $content . "
    						<tr>
                            <td><strong>".$all_user_subtitles[$i]['title']."</strong></td>
                            <td>
							<a href='../index.php?page=subtitle&subtitle_id=".$all_user_subtitles[$i]['id']."&action=open'><img src='templates/default/img/edit-icon.gif' title='edit subtitle'></a>
							</td>
							<td>
							<form method='post' action='index.php'>
							<input type='image' src='templates/default/img/hr.gif' title='delete subtitle'/>
							<input type='hidden' name='page' value='subtitles' />
							<input type='hidden' name='cat' value='view user subtitles' />
							<input type='hidden' name='delete_user_subtitle' value='yes' />
							<input type='hidden' name='find_user_subtitles' value='yes' />
							<input type='hidden' name='subtitle_user_name' value='".$subtitle_user_name."' />
							<input type='hidden' name='subtitle_id' value='".$all_user_subtitles[$i]['id']."' />
							</form>
							</td>
                        </tr>
					";
}

 $content = $content . "
                </table>
				</div>
				";
}


?>